package com.selfdriving.activity;

import java.util.ArrayList;
import java.util.List;

import net.tsz.afinal.annotation.view.ViewInject;

import com.selfdriving.R;
import com.selfdriving.adapter.FriendAdapter;
import com.selfdriving.adapter.GroupAdapter;
import com.selfdriving.bean.User;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class MyFriendActivity extends BaseActivity {
	@ViewInject(id = R.id.topBack, click = "topBack")
	ImageView topBack;

	@ViewInject(id = R.id.topText)
	TextView topText;

	@ViewInject(id = R.id.topRight, click = "topRight")
	Button topRight;
	
	@ViewInject(id=R.id.group_list)
	ListView group_list;
	
	@ViewInject(id=R.id.friend_list)
	ListView friend_list;
	
	private List<String> names;
	
	private List<User> users;
	
	private GroupAdapter groupAdapter;
	
	private FriendAdapter friendAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_friend);
		topRight.setVisibility(View.GONE);
		topText.setText("我的好友");
		names = new ArrayList<String>();
		users = new ArrayList<User>();
		for(int i=0;i<7;i++){
			String name = new String();
			name= "我的好友";
			names.add(name);
		}
		for(int i=0;i<7;i++){
			User user = new User();
			users.add(user);
		}
		groupAdapter = new GroupAdapter(this, names);
		group_list.setAdapter(groupAdapter);
		group_list.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				friendAdapter = new FriendAdapter(MyFriendActivity.this, users);
				friend_list.setAdapter(friendAdapter);
			}
		});
		
	}
	
	public void topBack(View v){
		this.finish();
	}

}
